




/*
'===============================================================================
'  MP.LayerHelper.MP_OBS.BL.MbUserControlManagerBase
'===============================================================================
*/

using System;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
using MP.LayerHelper.MP_OBS.BLL;
using MP.LayerHelper.MP_OBS.DAL;
using MP.LayerHelper.MP_OBS.DAL.EntityClasses;
using MP.LayerHelper.MP_OBS.DAL.FactoryClasses;
using MP.LayerHelper.MP_OBS.DAL.HelperClasses;
using SD.LLBLGen.Pro.ORMSupportClasses;

namespace MP.LayerHelper.MP_OBS.BLL
{
	public class MbUserControlManagerBase : ManagerBase
	{
		/// <summary>
		/// Purpose: Class constructor.
		/// </summary>
		
		public MbUserControlManagerBase()
		{
			// Nothing for now.
		}
		
		public override string TableName()
        {
            return "MbUserControl";
        }
		
		public MbUserControlEntity Insert(MbUserControlEntity _MbUserControlEntity)
		{
			return Insert(_MbUserControlEntity, "");
		}
		
		public MbUserControlEntity Insert(MbUserControlEntity _MbUserControlEntity, string controlId)
		{
			using(DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.SaveEntity(_MbUserControlEntity, true);
				MbUserControlFields field = new MbUserControlFields();
                LogEntity(_MbUserControlEntity, field, AcInsert, controlId);
			}
			return _MbUserControlEntity;
		}

		
		public MbUserControlEntity Insert(string ControlId, bool IsControl, string ControlCode, string ControlName, string ModCode, string RoleInit, bool IsEnable, DateTime CreatedDate)
		{
			MbUserControlEntity _MbUserControlEntity = new MbUserControlEntity();
			using(DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				
				_MbUserControlEntity.ControlId = ControlId;
				_MbUserControlEntity.IsControl = IsControl;
				_MbUserControlEntity.ControlCode = ControlCode;
				_MbUserControlEntity.ControlName = ControlName;
				_MbUserControlEntity.ModCode = ModCode;
				_MbUserControlEntity.RoleInit = RoleInit;
				_MbUserControlEntity.IsEnable = IsEnable;
				_MbUserControlEntity.CreatedDate = CreatedDate;
				MbUserControlFields field = new MbUserControlFields();
                LogEntity(_MbUserControlEntity, field, AcInsert);
				adapter.SaveEntity(_MbUserControlEntity, true);
			}
			return _MbUserControlEntity;
		}

		public MbUserControlEntity Insert(bool IsControl, string ControlCode, string ControlName, string ModCode, string RoleInit, bool IsEnable, DateTime CreatedDate)
		{
			MbUserControlEntity _MbUserControlEntity = new MbUserControlEntity();
			using(DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				
				_MbUserControlEntity.IsControl = IsControl;
				_MbUserControlEntity.ControlCode = ControlCode;
				_MbUserControlEntity.ControlName = ControlName;
				_MbUserControlEntity.ModCode = ModCode;
				_MbUserControlEntity.RoleInit = RoleInit;
				_MbUserControlEntity.IsEnable = IsEnable;
				_MbUserControlEntity.CreatedDate = CreatedDate;
				adapter.SaveEntity(_MbUserControlEntity, true);
				MbUserControlFields field = new MbUserControlFields();
                LogEntity(_MbUserControlEntity, field, AcInsert);
			}
			return _MbUserControlEntity;
		}
		
		public bool Update(MbUserControlEntity _MbUserControlEntity)
        {
            return Update(_MbUserControlEntity, "");
        }

		public bool Update(MbUserControlEntity _MbUserControlEntity, string controlId)
		{
			bool toReturn = false;
			using(DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				RelationPredicateBucket filter = new RelationPredicateBucket();
				IPredicateExpression _PredicateExpression = new PredicateExpression();
				_PredicateExpression.Add(MbUserControlFields.ControlId == _MbUserControlEntity.ControlId);
					
				filter.PredicateExpression.Add(_PredicateExpression);

				adapter.UpdateEntitiesDirectly(_MbUserControlEntity, filter);
				toReturn = true;
				
				MbUserControlFields field = new MbUserControlFields();
                LogEntity(_MbUserControlEntity, field, AcUpdate, controlId);
			}
			return toReturn;
		}
		
		public bool Update(MbUserControlEntity _MbUserControlEntity, RelationPredicateBucket filter)
		{
			bool toReturn = false;
			using(DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.UpdateEntitiesDirectly(_MbUserControlEntity, filter);
				toReturn = true;
				
				MbUserControlFields field = new MbUserControlFields();
                LogEntity(_MbUserControlEntity, field, AcUpdate);
			}
			return toReturn;
		}

		public bool Update(string ControlId, bool IsControl, string ControlCode, string ControlName, string ModCode, string RoleInit, bool IsEnable, DateTime CreatedDate)
		{
			bool toReturn = false;
			using(DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				MbUserControlEntity _MbUserControlEntity = new MbUserControlEntity(ControlId);
				if (adapter.FetchEntity(_MbUserControlEntity))
				{
				
					_MbUserControlEntity.IsControl = IsControl;
					_MbUserControlEntity.ControlCode = ControlCode;
					_MbUserControlEntity.ControlName = ControlName;
					_MbUserControlEntity.ModCode = ModCode;
					_MbUserControlEntity.RoleInit = RoleInit;
					_MbUserControlEntity.IsEnable = IsEnable;
					_MbUserControlEntity.CreatedDate = CreatedDate;
					adapter.SaveEntity(_MbUserControlEntity, true);
					toReturn = true;
					
					MbUserControlFields field = new MbUserControlFields();
					LogEntity(_MbUserControlEntity, field, AcUpdate);
				}
			}
			return toReturn;
		}

		public bool Delete(string ControlId)
		{
			bool toReturn = false;
			using(DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				MbUserControlEntity _MbUserControlEntity = new MbUserControlEntity(ControlId);
				if (adapter.FetchEntity(_MbUserControlEntity))
				{
					adapter.DeleteEntity(_MbUserControlEntity);
					toReturn = true;
				}
			}
			return toReturn;
		}
		
		public void DeleteAll() 
		{
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.DeleteEntitiesDirectly("MbUserControlEntity", null);
			}
		}
		
		
		public int DeleteByControlId(string ControlId)
		{
			int toReturn = 0;
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(MbUserControlFields.ControlId == ControlId);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				toReturn = adapter.DeleteEntitiesDirectly("MbUserControlEntity", filter);
			}
			return toReturn;
		}
		
		public int DeleteByIsControl(bool IsControl)
		{
			int toReturn = 0;
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(MbUserControlFields.IsControl == IsControl);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				toReturn = adapter.DeleteEntitiesDirectly("MbUserControlEntity", filter);
			}
			return toReturn;
		}
		
		public int DeleteByControlCode(string ControlCode)
		{
			int toReturn = 0;
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(MbUserControlFields.ControlCode == ControlCode);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				toReturn = adapter.DeleteEntitiesDirectly("MbUserControlEntity", filter);
			}
			return toReturn;
		}
		
		public int DeleteByControlName(string ControlName)
		{
			int toReturn = 0;
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(MbUserControlFields.ControlName == ControlName);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				toReturn = adapter.DeleteEntitiesDirectly("MbUserControlEntity", filter);
			}
			return toReturn;
		}
		
		public int DeleteByModCode(string ModCode)
		{
			int toReturn = 0;
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(MbUserControlFields.ModCode == ModCode);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				toReturn = adapter.DeleteEntitiesDirectly("MbUserControlEntity", filter);
			}
			return toReturn;
		}
		
		public int DeleteByRoleInit(string RoleInit)
		{
			int toReturn = 0;
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(MbUserControlFields.RoleInit == RoleInit);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				toReturn = adapter.DeleteEntitiesDirectly("MbUserControlEntity", filter);
			}
			return toReturn;
		}
		
		public int DeleteByIsEnable(bool IsEnable)
		{
			int toReturn = 0;
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(MbUserControlFields.IsEnable == IsEnable);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				toReturn = adapter.DeleteEntitiesDirectly("MbUserControlEntity", filter);
			}
			return toReturn;
		}
		
		public int DeleteByCreatedDate(DateTime CreatedDate)
		{
			int toReturn = 0;
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(MbUserControlFields.CreatedDate == CreatedDate);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				toReturn = adapter.DeleteEntitiesDirectly("MbUserControlEntity", filter);
			}
			return toReturn;
		}
		

		
		public MbUserControlEntity SelectOne(string ControlId)
		{
			MbUserControlEntity toReturn = null;
			using(DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				MbUserControlEntity _MbUserControlEntity = new MbUserControlEntity(ControlId);
				if (adapter.FetchEntity(_MbUserControlEntity))
				{
					toReturn = _MbUserControlEntity;
				}
			}
			return toReturn;
		}

		// Return DataTable
		public DataTable SelectAllRDT()
		{
			DataTable toReturn = new DataTable();
			EntityCollection _MbUserControlCollection = new EntityCollection(new MbUserControlEntityFactory());
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchTypedList(_MbUserControlCollection.EntityFactoryToUse.CreateFields(), toReturn, null, true);
			}
			return toReturn;
		}
		
		// Return EntityCollection<MbUserControlEntity>
		public EntityCollection<MbUserControlEntity> SelectAllLST()
		{
			EntityCollection<MbUserControlEntity> _MbUserControlCollection = new EntityCollection<MbUserControlEntity>();
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchEntityCollection(_MbUserControlCollection, null, 0, null);
			}
			return _MbUserControlCollection;
		}
		
		// Return EntityCollection<MbUserControlEntity>
		public EntityCollection<MbUserControlEntity> SelectAllLST_Paged(int PageNumber, int PageSize)
		{
			EntityCollection<MbUserControlEntity> _MbUserControlCollection = new EntityCollection<MbUserControlEntity>();
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchEntityCollection(_MbUserControlCollection, null, 0, null, null, PageNumber, PageSize);
			}
			return _MbUserControlCollection;
		}


		
		// Return EntityCollection<MbUserControlEntity>
		public EntityCollection<MbUserControlEntity> SelectByControlIdLST(string ControlId)
		{
			EntityCollection<MbUserControlEntity> _MbUserControlCollection = new EntityCollection<MbUserControlEntity>();
			RelationPredicateBucket filter = new RelationPredicateBucket();

			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(MbUserControlFields.ControlId == ControlId);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchEntityCollection(_MbUserControlCollection, filter, 0, null);
			}
			return _MbUserControlCollection;
		}
		
		// Return EntityCollection<MbUserControlEntity>
		public EntityCollection<MbUserControlEntity> SelectByControlIdLST_Paged(string ControlId, int PageNumber, int PageSize)
		{
			EntityCollection<MbUserControlEntity> _MbUserControlCollection = new EntityCollection<MbUserControlEntity>();
			RelationPredicateBucket filter = new RelationPredicateBucket();

			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(MbUserControlFields.ControlId == ControlId);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchEntityCollection(_MbUserControlCollection, filter, 0, null, null, PageNumber, PageSize);
			}
			return _MbUserControlCollection;
		}
		
		// Return DataTable
		public DataTable SelectByControlIdRDT(string ControlId)
		{
			DataTable toReturn = new DataTable();
			EntityCollection _MbUserControlCollection = new EntityCollection(new MbUserControlEntityFactory());
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(MbUserControlFields.ControlId == ControlId);
			filter.PredicateExpression.Add(_PredicateExpression);

			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchTypedList(_MbUserControlCollection.EntityFactoryToUse.CreateFields(), toReturn, filter, true);
			}
			return toReturn;
		}
		
		// Return DataTable
		public DataTable SelectByControlIdRDT_Paged(string ControlId, int PageNumber, int PageSize)
		{
			DataTable toReturn = new DataTable();
			EntityCollection _MbUserControlCollection = new EntityCollection(new MbUserControlEntityFactory());
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(MbUserControlFields.ControlId == ControlId);
			filter.PredicateExpression.Add(_PredicateExpression);

			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchTypedList(_MbUserControlCollection.EntityFactoryToUse.CreateFields(), toReturn, filter, 0, null, true, null, PageNumber, PageSize);
			}
			return toReturn;
		}


		
		// Return EntityCollection<MbUserControlEntity>
		public EntityCollection<MbUserControlEntity> SelectByIsControlLST(bool IsControl)
		{
			EntityCollection<MbUserControlEntity> _MbUserControlCollection = new EntityCollection<MbUserControlEntity>();
			RelationPredicateBucket filter = new RelationPredicateBucket();

			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(MbUserControlFields.IsControl == IsControl);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchEntityCollection(_MbUserControlCollection, filter, 0, null);
			}
			return _MbUserControlCollection;
		}
		
		// Return EntityCollection<MbUserControlEntity>
		public EntityCollection<MbUserControlEntity> SelectByIsControlLST_Paged(bool IsControl, int PageNumber, int PageSize)
		{
			EntityCollection<MbUserControlEntity> _MbUserControlCollection = new EntityCollection<MbUserControlEntity>();
			RelationPredicateBucket filter = new RelationPredicateBucket();

			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(MbUserControlFields.IsControl == IsControl);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchEntityCollection(_MbUserControlCollection, filter, 0, null, null, PageNumber, PageSize);
			}
			return _MbUserControlCollection;
		}
		
		// Return DataTable
		public DataTable SelectByIsControlRDT(bool IsControl)
		{
			DataTable toReturn = new DataTable();
			EntityCollection _MbUserControlCollection = new EntityCollection(new MbUserControlEntityFactory());
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(MbUserControlFields.IsControl == IsControl);
			filter.PredicateExpression.Add(_PredicateExpression);

			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchTypedList(_MbUserControlCollection.EntityFactoryToUse.CreateFields(), toReturn, filter, true);
			}
			return toReturn;
		}
		
		// Return DataTable
		public DataTable SelectByIsControlRDT_Paged(bool IsControl, int PageNumber, int PageSize)
		{
			DataTable toReturn = new DataTable();
			EntityCollection _MbUserControlCollection = new EntityCollection(new MbUserControlEntityFactory());
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(MbUserControlFields.IsControl == IsControl);
			filter.PredicateExpression.Add(_PredicateExpression);

			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchTypedList(_MbUserControlCollection.EntityFactoryToUse.CreateFields(), toReturn, filter, 0, null, true, null, PageNumber, PageSize);
			}
			return toReturn;
		}


		
		// Return EntityCollection<MbUserControlEntity>
		public EntityCollection<MbUserControlEntity> SelectByControlCodeLST(string ControlCode)
		{
			EntityCollection<MbUserControlEntity> _MbUserControlCollection = new EntityCollection<MbUserControlEntity>();
			RelationPredicateBucket filter = new RelationPredicateBucket();

			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(MbUserControlFields.ControlCode == ControlCode);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchEntityCollection(_MbUserControlCollection, filter, 0, null);
			}
			return _MbUserControlCollection;
		}
		
		// Return EntityCollection<MbUserControlEntity>
		public EntityCollection<MbUserControlEntity> SelectByControlCodeLST_Paged(string ControlCode, int PageNumber, int PageSize)
		{
			EntityCollection<MbUserControlEntity> _MbUserControlCollection = new EntityCollection<MbUserControlEntity>();
			RelationPredicateBucket filter = new RelationPredicateBucket();

			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(MbUserControlFields.ControlCode == ControlCode);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchEntityCollection(_MbUserControlCollection, filter, 0, null, null, PageNumber, PageSize);
			}
			return _MbUserControlCollection;
		}
		
		// Return DataTable
		public DataTable SelectByControlCodeRDT(string ControlCode)
		{
			DataTable toReturn = new DataTable();
			EntityCollection _MbUserControlCollection = new EntityCollection(new MbUserControlEntityFactory());
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(MbUserControlFields.ControlCode == ControlCode);
			filter.PredicateExpression.Add(_PredicateExpression);

			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchTypedList(_MbUserControlCollection.EntityFactoryToUse.CreateFields(), toReturn, filter, true);
			}
			return toReturn;
		}
		
		// Return DataTable
		public DataTable SelectByControlCodeRDT_Paged(string ControlCode, int PageNumber, int PageSize)
		{
			DataTable toReturn = new DataTable();
			EntityCollection _MbUserControlCollection = new EntityCollection(new MbUserControlEntityFactory());
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(MbUserControlFields.ControlCode == ControlCode);
			filter.PredicateExpression.Add(_PredicateExpression);

			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchTypedList(_MbUserControlCollection.EntityFactoryToUse.CreateFields(), toReturn, filter, 0, null, true, null, PageNumber, PageSize);
			}
			return toReturn;
		}


		
		// Return EntityCollection<MbUserControlEntity>
		public EntityCollection<MbUserControlEntity> SelectByControlNameLST(string ControlName)
		{
			EntityCollection<MbUserControlEntity> _MbUserControlCollection = new EntityCollection<MbUserControlEntity>();
			RelationPredicateBucket filter = new RelationPredicateBucket();

			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(MbUserControlFields.ControlName == ControlName);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchEntityCollection(_MbUserControlCollection, filter, 0, null);
			}
			return _MbUserControlCollection;
		}
		
		// Return EntityCollection<MbUserControlEntity>
		public EntityCollection<MbUserControlEntity> SelectByControlNameLST_Paged(string ControlName, int PageNumber, int PageSize)
		{
			EntityCollection<MbUserControlEntity> _MbUserControlCollection = new EntityCollection<MbUserControlEntity>();
			RelationPredicateBucket filter = new RelationPredicateBucket();

			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(MbUserControlFields.ControlName == ControlName);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchEntityCollection(_MbUserControlCollection, filter, 0, null, null, PageNumber, PageSize);
			}
			return _MbUserControlCollection;
		}
		
		// Return DataTable
		public DataTable SelectByControlNameRDT(string ControlName)
		{
			DataTable toReturn = new DataTable();
			EntityCollection _MbUserControlCollection = new EntityCollection(new MbUserControlEntityFactory());
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(MbUserControlFields.ControlName == ControlName);
			filter.PredicateExpression.Add(_PredicateExpression);

			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchTypedList(_MbUserControlCollection.EntityFactoryToUse.CreateFields(), toReturn, filter, true);
			}
			return toReturn;
		}
		
		// Return DataTable
		public DataTable SelectByControlNameRDT_Paged(string ControlName, int PageNumber, int PageSize)
		{
			DataTable toReturn = new DataTable();
			EntityCollection _MbUserControlCollection = new EntityCollection(new MbUserControlEntityFactory());
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(MbUserControlFields.ControlName == ControlName);
			filter.PredicateExpression.Add(_PredicateExpression);

			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchTypedList(_MbUserControlCollection.EntityFactoryToUse.CreateFields(), toReturn, filter, 0, null, true, null, PageNumber, PageSize);
			}
			return toReturn;
		}


		
		// Return EntityCollection<MbUserControlEntity>
		public EntityCollection<MbUserControlEntity> SelectByModCodeLST(string ModCode)
		{
			EntityCollection<MbUserControlEntity> _MbUserControlCollection = new EntityCollection<MbUserControlEntity>();
			RelationPredicateBucket filter = new RelationPredicateBucket();

			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(MbUserControlFields.ModCode == ModCode);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchEntityCollection(_MbUserControlCollection, filter, 0, null);
			}
			return _MbUserControlCollection;
		}
		
		// Return EntityCollection<MbUserControlEntity>
		public EntityCollection<MbUserControlEntity> SelectByModCodeLST_Paged(string ModCode, int PageNumber, int PageSize)
		{
			EntityCollection<MbUserControlEntity> _MbUserControlCollection = new EntityCollection<MbUserControlEntity>();
			RelationPredicateBucket filter = new RelationPredicateBucket();

			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(MbUserControlFields.ModCode == ModCode);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchEntityCollection(_MbUserControlCollection, filter, 0, null, null, PageNumber, PageSize);
			}
			return _MbUserControlCollection;
		}
		
		// Return DataTable
		public DataTable SelectByModCodeRDT(string ModCode)
		{
			DataTable toReturn = new DataTable();
			EntityCollection _MbUserControlCollection = new EntityCollection(new MbUserControlEntityFactory());
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(MbUserControlFields.ModCode == ModCode);
			filter.PredicateExpression.Add(_PredicateExpression);

			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchTypedList(_MbUserControlCollection.EntityFactoryToUse.CreateFields(), toReturn, filter, true);
			}
			return toReturn;
		}
		
		// Return DataTable
		public DataTable SelectByModCodeRDT_Paged(string ModCode, int PageNumber, int PageSize)
		{
			DataTable toReturn = new DataTable();
			EntityCollection _MbUserControlCollection = new EntityCollection(new MbUserControlEntityFactory());
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(MbUserControlFields.ModCode == ModCode);
			filter.PredicateExpression.Add(_PredicateExpression);

			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchTypedList(_MbUserControlCollection.EntityFactoryToUse.CreateFields(), toReturn, filter, 0, null, true, null, PageNumber, PageSize);
			}
			return toReturn;
		}


		
		// Return EntityCollection<MbUserControlEntity>
		public EntityCollection<MbUserControlEntity> SelectByRoleInitLST(string RoleInit)
		{
			EntityCollection<MbUserControlEntity> _MbUserControlCollection = new EntityCollection<MbUserControlEntity>();
			RelationPredicateBucket filter = new RelationPredicateBucket();

			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(MbUserControlFields.RoleInit == RoleInit);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchEntityCollection(_MbUserControlCollection, filter, 0, null);
			}
			return _MbUserControlCollection;
		}
		
		// Return EntityCollection<MbUserControlEntity>
		public EntityCollection<MbUserControlEntity> SelectByRoleInitLST_Paged(string RoleInit, int PageNumber, int PageSize)
		{
			EntityCollection<MbUserControlEntity> _MbUserControlCollection = new EntityCollection<MbUserControlEntity>();
			RelationPredicateBucket filter = new RelationPredicateBucket();

			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(MbUserControlFields.RoleInit == RoleInit);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchEntityCollection(_MbUserControlCollection, filter, 0, null, null, PageNumber, PageSize);
			}
			return _MbUserControlCollection;
		}
		
		// Return DataTable
		public DataTable SelectByRoleInitRDT(string RoleInit)
		{
			DataTable toReturn = new DataTable();
			EntityCollection _MbUserControlCollection = new EntityCollection(new MbUserControlEntityFactory());
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(MbUserControlFields.RoleInit == RoleInit);
			filter.PredicateExpression.Add(_PredicateExpression);

			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchTypedList(_MbUserControlCollection.EntityFactoryToUse.CreateFields(), toReturn, filter, true);
			}
			return toReturn;
		}
		
		// Return DataTable
		public DataTable SelectByRoleInitRDT_Paged(string RoleInit, int PageNumber, int PageSize)
		{
			DataTable toReturn = new DataTable();
			EntityCollection _MbUserControlCollection = new EntityCollection(new MbUserControlEntityFactory());
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(MbUserControlFields.RoleInit == RoleInit);
			filter.PredicateExpression.Add(_PredicateExpression);

			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchTypedList(_MbUserControlCollection.EntityFactoryToUse.CreateFields(), toReturn, filter, 0, null, true, null, PageNumber, PageSize);
			}
			return toReturn;
		}


		
		// Return EntityCollection<MbUserControlEntity>
		public EntityCollection<MbUserControlEntity> SelectByIsEnableLST(bool IsEnable)
		{
			EntityCollection<MbUserControlEntity> _MbUserControlCollection = new EntityCollection<MbUserControlEntity>();
			RelationPredicateBucket filter = new RelationPredicateBucket();

			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(MbUserControlFields.IsEnable == IsEnable);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchEntityCollection(_MbUserControlCollection, filter, 0, null);
			}
			return _MbUserControlCollection;
		}
		
		// Return EntityCollection<MbUserControlEntity>
		public EntityCollection<MbUserControlEntity> SelectByIsEnableLST_Paged(bool IsEnable, int PageNumber, int PageSize)
		{
			EntityCollection<MbUserControlEntity> _MbUserControlCollection = new EntityCollection<MbUserControlEntity>();
			RelationPredicateBucket filter = new RelationPredicateBucket();

			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(MbUserControlFields.IsEnable == IsEnable);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchEntityCollection(_MbUserControlCollection, filter, 0, null, null, PageNumber, PageSize);
			}
			return _MbUserControlCollection;
		}
		
		// Return DataTable
		public DataTable SelectByIsEnableRDT(bool IsEnable)
		{
			DataTable toReturn = new DataTable();
			EntityCollection _MbUserControlCollection = new EntityCollection(new MbUserControlEntityFactory());
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(MbUserControlFields.IsEnable == IsEnable);
			filter.PredicateExpression.Add(_PredicateExpression);

			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchTypedList(_MbUserControlCollection.EntityFactoryToUse.CreateFields(), toReturn, filter, true);
			}
			return toReturn;
		}
		
		// Return DataTable
		public DataTable SelectByIsEnableRDT_Paged(bool IsEnable, int PageNumber, int PageSize)
		{
			DataTable toReturn = new DataTable();
			EntityCollection _MbUserControlCollection = new EntityCollection(new MbUserControlEntityFactory());
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(MbUserControlFields.IsEnable == IsEnable);
			filter.PredicateExpression.Add(_PredicateExpression);

			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchTypedList(_MbUserControlCollection.EntityFactoryToUse.CreateFields(), toReturn, filter, 0, null, true, null, PageNumber, PageSize);
			}
			return toReturn;
		}


		
		// Return EntityCollection<MbUserControlEntity>
		public EntityCollection<MbUserControlEntity> SelectByCreatedDateLST(DateTime CreatedDate)
		{
			EntityCollection<MbUserControlEntity> _MbUserControlCollection = new EntityCollection<MbUserControlEntity>();
			RelationPredicateBucket filter = new RelationPredicateBucket();

			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(MbUserControlFields.CreatedDate == CreatedDate);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchEntityCollection(_MbUserControlCollection, filter, 0, null);
			}
			return _MbUserControlCollection;
		}
		
		// Return EntityCollection<MbUserControlEntity>
		public EntityCollection<MbUserControlEntity> SelectByCreatedDateLST_Paged(DateTime CreatedDate, int PageNumber, int PageSize)
		{
			EntityCollection<MbUserControlEntity> _MbUserControlCollection = new EntityCollection<MbUserControlEntity>();
			RelationPredicateBucket filter = new RelationPredicateBucket();

			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(MbUserControlFields.CreatedDate == CreatedDate);
			filter.PredicateExpression.Add(_PredicateExpression);
			
			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchEntityCollection(_MbUserControlCollection, filter, 0, null, null, PageNumber, PageSize);
			}
			return _MbUserControlCollection;
		}
		
		// Return DataTable
		public DataTable SelectByCreatedDateRDT(DateTime CreatedDate)
		{
			DataTable toReturn = new DataTable();
			EntityCollection _MbUserControlCollection = new EntityCollection(new MbUserControlEntityFactory());
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(MbUserControlFields.CreatedDate == CreatedDate);
			filter.PredicateExpression.Add(_PredicateExpression);

			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchTypedList(_MbUserControlCollection.EntityFactoryToUse.CreateFields(), toReturn, filter, true);
			}
			return toReturn;
		}
		
		// Return DataTable
		public DataTable SelectByCreatedDateRDT_Paged(DateTime CreatedDate, int PageNumber, int PageSize)
		{
			DataTable toReturn = new DataTable();
			EntityCollection _MbUserControlCollection = new EntityCollection(new MbUserControlEntityFactory());
			RelationPredicateBucket filter = new RelationPredicateBucket();
			
			IPredicateExpression _PredicateExpression = new PredicateExpression();
			_PredicateExpression.Add(MbUserControlFields.CreatedDate == CreatedDate);
			filter.PredicateExpression.Add(_PredicateExpression);

			using (DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
			{
				adapter.FetchTypedList(_MbUserControlCollection.EntityFactoryToUse.CreateFields(), toReturn, filter, 0, null, true, null, PageNumber, PageSize);
			}
			return toReturn;
		}


		
		

	}
}
